package com.yuyou.fn.controller;


import com.alibaba.fastjson.JSONObject;
import com.github.wens.mybatisplus.examples.Example;
import com.github.wens.mybatisplus.plugins.Page;
import com.yuyou.fn.common.entity.ConfigurationTable;
import com.yuyou.fn.common.service.IConfigurationTableService;
import com.yuyou.fn.common.util.BeanUtils;
import com.yuyou.fn.common.util.MapBaidu;
import com.yuyou.fn.educational.entity.*;
import com.yuyou.fn.educational.service.*;

import com.yuyou.fn.educational.vo.CampusCondVo;
import com.yuyou.fn.educational.vo.TeacherQueryVo;
import com.yuyou.fn.platform.entity.CustomerUser;
import com.yuyou.fn.platform.service.IAccessTokenService;
import com.yuyou.fn.platform.vo.AccessTokenVo;
import com.yuyou.fn.portal.entity.*;
import com.yuyou.fn.portal.service.*;
import com.yuyou.fn.portal.vo.*;
import com.yuyou.fn.vo.CustomerUserLoginSuccessVo;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;


/**
 * Created by wens on 16/10/24.
 */

@Controller
@RequestMapping(value="/api/m")
public class MApiController {

    @Resource
    private ICustomerUserService customerUserService ;


    @Resource
    private IOuterFeedbackService outerFeedbackService;

    @Resource
    private IOuterCourseOrderService outerCourseOrderService;

    @Resource
    private IOuterShoppingcartService outerShoppingcartService;

    @Resource
    private IOuterCollectionService outerCollectionService;


    @Resource
    private ITeacherService teacherService;

    @Resource
    private IAccessTokenService accessTokenService ;

    @Resource
    private ICustomerBindStudentService customerBindStudentService;

    @Resource
    private IOuterCourseClassService outerCourseClassService;

    @Resource
    private IConfigurationTableService configurationTableService;

    @Resource
    private IOuterCampusService outerCampusService;

    @Resource
    private IStudentRegService studentRegService;

    @Resource
    private IClassTimeService classTimeService;

    @Resource
    private ICourseClassService courseClassService;

    @Resource
    private ICampusService campusService;

    @Resource
    private IOuterTeacherService outerTeacherService;


    @ApiOperation("微信登录")
    @RequestMapping("/wx/login")
    @ResponseBody
    public ReturnResult<CustomerUser> wxLogin( @RequestParam("openId") String openId , @RequestParam(value = "nickname" , required = false ) String nickname ,@RequestParam(value = "sex" , required = false ) String sex , @RequestParam(value = "province" , required = false) String province ,@RequestParam(value = "city",required = false) String city  ,@RequestParam(value = "avatar",required = false) String avatar ) {
        CustomerUser customerUser = customerUserService.loginFormWx(openId, nickname, sex, province, city, avatar);
        String token = accessTokenService.generateToken(customerUser.getUserId());
        return ReturnResult.success(new CustomerUserLoginSuccessVo(token,customerUser));
    }



    @ApiOperation("移动端配置")
    @RequestMapping(value = "/config" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<JSONObject> courseSearchCondition(@RequestParam("city") String city, HttpServletRequest request) throws IOException {
        String file = MApiController.class.getClassLoader().getResource("mobile_config.json").getFile();
        String configJSON = FileUtils.readFileToString(new File(file), "utf-8");
        JSONObject config = JSONObject.parseObject(configJSON);
        JSONObject jsonObject = config.getJSONObject(city);
        if(jsonObject == null ){
            city = "广州" ;
            jsonObject = config.getJSONObject(city);
        }

        List<Campus> campusList = campusService.findCampusByCity(city);
        Map<String,Object> campusConifg = new HashMap<>();
        for(Campus campus : campusList ){
            if(!campusConifg.containsKey(campus.getDistrict())){
                campusConifg.put(campus.getDistrict(),new ArrayList<Map<String,Object>>(10) );
            }
            List<Map<String,Object>> campuses = (List<Map<String,Object>>)campusConifg.get(campus.getDistrict());
            Map<String,Object> c = new HashMap<>();
            c.put("name",campus.getCampusName());
            c.put("value",campus.getCampusId());
            campuses.add(c);
        }

        List<Map<String,Object>> campusConfigList  = new ArrayList<>(10);
        for(String key : campusConifg.keySet()){
            Map<String,Object> m  = new HashMap<>();
            m.put("name" , key );
            m.put("value" , key);
            m.put("campuses" , campusConifg.get(key));
            campusConfigList.add(m);
        }

        jsonObject.put("campus" , campusConfigList) ;

        return ReturnResult.success(jsonObject);
    }




    @ApiOperation("查询课程列表")
    @RequestMapping(value = "/outCourseClassList" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<CourseClassResultVo>> outCourseClassList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize, OuterCourseClassQueryVo outerCourseClassQueryVo, HttpServletRequest request) {
        List<CourseClassResultVo> outerCourseClasses=outerCourseClassService.findByCondition(outerCourseClassQueryVo,pageNo,pageSize);
        return ReturnResult.success(outerCourseClasses);
    }

    @ApiOperation("查询课程详情")
    @RequestMapping(value = "/outCourseClass" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<CourseClassDetail> outCourseClass(@RequestParam(value = "classId",required = true) Long classId, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        CourseClassDetail courseClassDetail=new CourseClassDetail();
        BeanUtils.copyProperties(courseClassDetail, outerCourseClassService.findByClassId(classId));
        //是否被收藏
        OuterCollection outerCollection =outerCollectionService.findByUserIdAndObjType(userId,classId,0);//0代表课程
        if (outerCollection!=null && outerCollection.getOuterCollectionId()!=null){
            courseClassDetail.setIsCollection(1L);
            courseClassDetail.setOuterCollectionId(outerCollection.getOuterCollectionId());
        }else{
            courseClassDetail.setIsCollection(0L);
            courseClassDetail.setOuterCollectionId(null);
        }

        return ReturnResult.success(courseClassDetail);
    }

    @ApiOperation("查询老师列表")
    @RequestMapping(value = "/teachers" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult< List<TeacherListResultVo>> teachers(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize, OuterTeacher outerTeacher, HttpServletRequest request) {
        //teacherQueryVo.setStatus(1);//在职老师
       /* Page page=teacherService.findTeacherByQueryForPage(teacherQueryVo,pageNo,pageSize);
        List<Teacher> teacherList=page.getRecords();*/

        List<OuterTeacher> outerTeacherList=outerTeacherService.findTeacherByCond(pageNo,pageSize,outerTeacher);
        List<TeacherListResultVo> teacherListResultVoList=new ArrayList<TeacherListResultVo>();
        for(OuterTeacher outerTeacher1:outerTeacherList){
            TeacherListResultVo teacherListResultVo=new TeacherListResultVo();
            BeanUtils.copyProperties(teacherListResultVo,outerTeacher1);
            teacherListResultVoList.add(teacherListResultVo);
        }
        //page.setRecords(teacherListResultVoList);
        return ReturnResult.success(teacherListResultVoList);
    }

    @ApiOperation("老师主页(个人信息)")
    @RequestMapping(value = "/teacherDetail" ,method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<TeacherListResultVo> teacherDetail(@RequestParam("teacherId") Long teacherId, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        Teacher teacher=teacherService.findById(teacherId);
        TeacherListResultVo teacherListResultVo=new TeacherListResultVo();
        BeanUtils.copyProperties(teacherListResultVo,teacher);
        OuterCollection outerCollection=outerCollectionService.findByUserIdAndObjType(userId,teacherId,1);//0代表老师
        if (outerCollection!=null &&outerCollection.getOuterCollectionId()!=null){
            teacherListResultVo.setIsCollection(1L);//已收藏
            teacherListResultVo.setOuterCollectionId(outerCollection.getOuterCollectionId());
        }else{
            teacherListResultVo.setIsCollection(0L);//未收藏
            teacherListResultVo.setOuterCollectionId(null);
        }

        return ReturnResult.success(teacherListResultVo);
    }

    @ApiOperation("查找老师课程")
    @RequestMapping(value = "/teacherClass" ,method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<CourseClassResultVo>> teacherClass(@RequestParam(value = "pageNo") int pageNo,@RequestParam(value = "pageSize") int pageSize,@RequestParam("teacherId") Long teacherId, HttpServletRequest request) {
        OuterCourseClassQueryVo outerCourseClassQueryVo=new OuterCourseClassQueryVo();
        outerCourseClassQueryVo.setTeacherIds(teacherId+"");
        List<CourseClassResultVo> outerCourseClassList=outerCourseClassService.findByCondition(outerCourseClassQueryVo,pageNo,pageSize);
        return ReturnResult.success(outerCourseClassList);
    }

    @ApiOperation("购物车列表")
    @RequestMapping(value = "/shoppingCartList" ,method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult< List<ShoppingCartDetailVo>> shoppingCartList(HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        List<ShoppingCartDetailVo> shoppingCartDetailVoList=outerShoppingcartService.findShoppingCartList(userId);
        return ReturnResult.success(shoppingCartDetailVoList);
    }



    @ApiOperation("添加到购物车")
    @RequestMapping(value = "/addToShoppingCart" ,method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Void> addToShoppingCart(@RequestParam(value = "classId") Long classId, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        outerShoppingcartService.addToShoppingCart(classId,userId);
        return ReturnResult.success("添加成功");
    }

    @ApiOperation("删除购物车")
    @RequestMapping(value = "/deleteShoppingCart" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<OuterShoppingcart> deleteShoppingCart(@RequestParam(value="outerShoppingCartIds[]") List<Long> outerShoppingCartIds, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        outerShoppingcartService.deleteShoppingCart(outerShoppingCartIds,userId);
        return ReturnResult.success("删除成功");
    }




    @ApiOperation("更新购物车里课程人员")
    @RequestMapping(value = "/updateShoppingCartStudent" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Void> updateShoppingCartStudent(@RequestParam(value = "studentIds[]" , required = false) List<Long> studentIds,
            @RequestParam("outerShoppingcartId")  Long outerShoppingcartId,HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        if(studentIds == null ){
            studentIds = Collections.EMPTY_LIST ;
        }
        outerShoppingcartService.updateShoppingCartStudent(studentIds,outerShoppingcartId,userId);
        return ReturnResult.success("ok");
    }


    @ApiOperation("立即报名（选择学生后调用）")
    @RequestMapping(value = "/createOneOuterCourseOrder" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Long> createOneOuterCourseOrder(@RequestParam(value = "classId") Long classId,@RequestParam("studentIds") String studentIds, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        OrderCourseClass orderCourseClass=outerCourseOrderService.createOuterCourseOrder(classId,studentIds,userId);

        return ReturnResult.success(orderCourseClass.getOuterCourseOrderId());
    }






    @ApiOperation("购物车结算")
    @RequestMapping(value = "/createOuterCourseOrders" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Long> createOuterCourseOrders(@RequestParam(value = "outerShoppingCartIds[]") List<Long> outerShoppingCartIds, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        OrderCourseClass orderCourseClass=outerCourseOrderService.createOuterCourseOrder(outerShoppingCartIds,userId);

        return ReturnResult.success(orderCourseClass.getOuterCourseOrderId());
    }


    @ApiOperation("订单支付完成更新订单")
    @RequestMapping(value = "/payOuterCourseOrder" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Void> payOuterCourseOrder(@RequestParam("payWay") Integer payWay , @RequestParam("payAmount") BigDecimal payAmount , @RequestParam(value ="outerCourseOrderId") Long outCourseOrderId, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
       outerCourseOrderService.payOuterCourseOrder(outCourseOrderId,payAmount,payWay,userId);
        return ReturnResult.success("ok");
    }

    @ApiOperation("得到订单列表")
    @RequestMapping(value = "/findOuterCourseOrder" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<OrderCourseClass>> findOuterCourseOrder(@RequestParam("pageNo") int pageNo,@RequestParam("pageSize") int pageSize, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        List<OrderCourseClass> list=outerCourseOrderService.findOuterCourseOrder(userId,pageNo,pageSize);
        return ReturnResult.success(list);
    }

    @ApiOperation("根据订单id查询订单")
    @RequestMapping(value = "/findOneOuterCourseOrder" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public  ReturnResult<OrderCourseClass> findOuterCourseOrder(@RequestParam("outerCourseOrderId") Long outerCourseOrderId, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        OrderCourseClass orderCourseClass=outerCourseOrderService.findOuterCourseOrder(userId,outerCourseOrderId);
        return ReturnResult.success(orderCourseClass);
    }



    @ApiOperation("添加收藏")
    @RequestMapping(value = "/addOuterCollection" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Long> addOuterCollection(OuterCollection outerCollection, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        Long outerConllectionId=outerCollectionService.addOuterCollection(outerCollection,userId);
        return ReturnResult.success(outerConllectionId);
    }



    @ApiOperation("删除收藏")
    @RequestMapping(value = "/deleteOuterCollection", method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<OuterCollection> deleteOuterCollection(@RequestParam(value="outerCollectionIds[]") List<Long> outerCollectionIds, HttpServletRequest request) {

        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();

        outerCollectionService.deleteOuterCollection(userId,outerCollectionIds);
        return ReturnResult.success("删除成功");
    }

    @ApiOperation("得到收藏列表")
    @RequestMapping(value = "/findOuterCollection", method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<Object>> findOuterCollection(@RequestParam("pageNo") int pageNo,@RequestParam("pageSize") int pageSize, HttpServletRequest request) {

        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();

        List<Object> list=outerCollectionService.findOuterCollection(pageNo,pageSize,userId);

        return ReturnResult.success(list);
    }


    @ApiOperation("新增学员并且加入对应购物车")
    @RequestMapping(value = "addNewStudentToCart", method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<HashMap<String,String>> addNewStudentToCart(@RequestParam(value ="outerShoppingCartIds[]" ,required = false) List<Long> outerShoppingCartIds, Student student, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        outerShoppingcartService.addNewStudentToCart(outerShoppingCartIds,student,userId);
        return ReturnResult.success("添加成功");
    }




    @ApiOperation("得到课程列表")
    @RequestMapping(value = "/findOuterCourseClass", method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<OrderCourseClass>> findOuterCourseClass(@RequestParam("pageNo") int pageNo,@RequestParam("pageSize") int pageSize,@RequestParam("chargingStatus") int chargingStatus, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        List<OrderCourseClass> list=outerCourseOrderService.findOuterCourseOrder(userId,pageNo,pageSize,chargingStatus);

        return ReturnResult.success(list);
    }


    @ApiOperation("更改个人信息")
    @RequestMapping(value = "/updatePersonMessage",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<CustomerUser> updatePersonMessage( CustomerUser customerUser, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        customerUser.setUserId(userId);
        customerUserService.updatePersonMessage(customerUser);
        return ReturnResult.success("ok");
    }




    @ApiOperation("得到用户绑定的学员")
    @RequestMapping(value = "/findCustomerBindStudent" ,method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<CustomerBindStudent>> findCustomerBindStudent(HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        return  ReturnResult.success(customerBindStudentService.findStudentsByUserIds(userId));
    }
    @ApiOperation("联系我们")
    @RequestMapping(value = "/contactUs",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Void> contactUs(OuterFeedback outerFeedback, HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        outerFeedback.setUserId(userId);
        outerFeedbackService.contactUs(outerFeedback);
        return ReturnResult.success("ok");
    }


    @ApiOperation("得到配置信息（如搜索条件等）")
    @RequestMapping(value = "/findConfigByCond" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<HashMap<String,Object>> findConfigByCond(ConfigurationTable configurationTable, HttpServletRequest request) {
        HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);
        return ReturnResult.success(resultMap);
    }

    @ApiOperation("根据经纬度搜索附近校区")
    @RequestMapping(value = "/findCampusByPosition" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<OuterCampus>> findCampusByPosition(@RequestParam(value = "distance",required = false,defaultValue = "10000") Double distance,@RequestParam(value = "longitude") Double longitude,@RequestParam(value = "latitude") Double latitude, HttpServletRequest request) {
       // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);

        return ReturnResult.success(outerCampusService.findCampusByPosition(distance,longitude,latitude));
    }


/*
    @ApiOperation("根据地理名称搜索附近校区")
    @RequestMapping(value = "/findCampusByPositionName" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<OuterCampus>> findCampusByPositionName(@RequestParam(value = "distance",required = false,defaultValue = "10000") Double distance,@RequestParam(value = "longitude") Double longitude,@RequestParam(value = "latitude") Double latitude, HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);

        return ReturnResult.success(outerCampusService.findCampusByPosition(distance,longitude,latitude));
    }

*/

    @ApiOperation("查询个人信息")
    @RequestMapping(value = "/personMessage",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<PersonMessageVo> personMessage(  HttpServletRequest request) {
        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        CustomerUser customerUser=customerUserService.findById(userId);
        PersonMessageVo personMessageVo=new PersonMessageVo();
        BeanUtils.copyProperties(personMessageVo,customerUser);
        personMessageVo.setShoppingCartNum(outerShoppingcartService.countNumByUserId(userId));
        personMessageVo.setCollectionNum(outerCollectionService.countNumByUserId(userId));
        return ReturnResult.success(personMessageVo);
    }


    @ApiOperation("我的课表")
    @RequestMapping(value = "/schedule" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<ScheduleInfoVo>> schedule(@RequestParam(value = "dateString",required = true) String  dateString, HttpServletRequest request) {

        AccessTokenVo accessTokenVo=(AccessTokenVo)request.getAttribute("accessToken");
        Long userId=accessTokenVo.getUserId();
        List<ScheduleInfoVo> scheduleInfoVoList=outerCourseClassService.findScheduleInfoByUserIdAndDate(userId,dateString);

        return ReturnResult.success(scheduleInfoVoList);
    }

    @ApiOperation("根据地名得到经纬度")
    @RequestMapping(value = "/lngAndLatByPositionName" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Map<String,Double>> lngAndLatByPositionName(@RequestParam(value = "positonName",required = true) String positionName, HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);
        Map<String,Double> map= MapBaidu.findLngAndLat(positionName);

        return ReturnResult.success(map);
    }


    @ApiOperation("根据经纬度得到地名")
    @RequestMapping(value = "/positionNameByLngAndLat" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<JSONObject> positionNameByLngAndLat(@RequestParam(value = "lng",required = true) Double lng, @RequestParam(value = "lat",required = true) Double lat, HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);
        JSONObject jsonObject=MapBaidu.findPositionByLngAndLat(lng,lat);// MapBaidu.getLngAndLat(positionName);

        return ReturnResult.success(jsonObject);
    }

    @ApiOperation("得到校区搜索条件")
    @RequestMapping(value = "/findCampusCond" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<List<CampusCondVo>> findCampusCond(@RequestParam(value = "city",required = true,defaultValue = "广州") String  city,HttpServletRequest request) {
        List<CampusCondVo> campusCondVoList=campusService.findCampusCond(city);
        return ReturnResult.success(campusCondVoList);
    }


    @ApiOperation("Student入参描述2")
    @RequestMapping(value = "/test" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<Student> test2(@RequestParam(value = "distance",required = false,defaultValue = "10000") Double distance,@RequestParam(value = "longitude") Double longitude,@RequestParam(value = "latitude") Double latitude, HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);

        return ReturnResult.success("ok");
    }

    @ApiOperation("OuterFeedback入参描述")
    @RequestMapping(value = "/test1" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<OuterFeedback> test1(@RequestParam(value = "distance",required = false,defaultValue = "10000") Double distance,@RequestParam(value = "longitude") Double longitude,@RequestParam(value = "latitude") Double latitude, HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);

        return ReturnResult.success("ok");
    }


    @ApiOperation("outerCourseClassQueryVo入参描述")
    @RequestMapping(value = "/test3" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<OuterCourseClassQueryVo> test3( HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);

        return ReturnResult.success("ok");
    }

    @ApiOperation("ConfigurationTable入参描述")
    @RequestMapping(value = "/test4" , method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public ReturnResult<ConfigurationTable> test4(@RequestParam(value = "distance",required = false,defaultValue = "10000") Double distance,@RequestParam(value = "longitude") Double longitude,@RequestParam(value = "latitude") Double latitude, HttpServletRequest request) {
        // HashMap<String,Object> resultMap=configurationTableService.findConfigByCond(configurationTable);

        return ReturnResult.success("ok");
    }




}
